import React, { Component } from 'react';
import { connect } from 'dva';
import { Redirect } from 'dva/router'


const Authorization = (PageComponent) => {
  @connect(state => state.user)
  class AuthorizationComponent extends PageComponent {
    render() {
      console.log(this.props)
      if (this.props.token) {
        return super.render()
      }
      return <Redirect to="/login" />
    }
  }

  return AuthorizationComponent
}

export default Authorization